﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;


namespace Fav
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Set the data context of the listbox control to the sample data
            DataContext = App.ViewModel;
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }

        // Load data for the ViewModel Items
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (!App.ViewModel.IsDataLoaded)
            {
                App.ViewModel.LoadData();
            }

            //int panels = 3; 

            var MW = new MasonryView(Boxi, 3, 10);
            
           

            MW.AddItem(new Rectangle() { Width = 100, Height = 200, Fill = new SolidColorBrush(Colors.Green) });
            MW.AddItem(new Rectangle() { Width = 100, Height = 250, Fill = new SolidColorBrush(Colors.Red) });
            MW.AddItem(new Rectangle() { Width = 100, Height = 300, Fill = new SolidColorBrush(Colors.Blue) });
            MW.AddItem(new Rectangle() { Width = 200, Height = 350, Fill = new SolidColorBrush(Colors.Cyan) });
            MW.AddItem(new Rectangle() { Width = 100, Height = 200, Fill = new SolidColorBrush(Colors.Green) });
            MW.AddItem(new Rectangle() { Width = 100, Height = 250, Fill = new SolidColorBrush(Colors.Red) });
            MW.AddItem(new Rectangle() { Width = 100, Height = 300, Fill = new SolidColorBrush(Colors.Blue) });
            MW.AddItem(new Rectangle() { Width = 200, Height = 350, Fill = new SolidColorBrush(Colors.Cyan) });
            MW.AddItem(new Rectangle() { Width = 100, Height = 200, Fill = new SolidColorBrush(Colors.Green) });
            MW.AddItem(new Rectangle() { Width = 100, Height = 250, Fill = new SolidColorBrush(Colors.Red) });
            MW.AddItem(new Rectangle() { Width = 100, Height = 300, Fill = new SolidColorBrush(Colors.Blue) });
            MW.AddItem(new Rectangle() { Width = 200, Height = 350, Fill = new SolidColorBrush(Colors.Cyan) });
            //stackpanelLeft.Measure(new Size(1000, 1000));
            //stackpanelLeft.Arrange(new Rect(0, 0, 1000, 1000));
            //stackpanelLeft.UpdateLayout();
            
        }
    }
}